package com.snailhd.framework.common.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 分页对象
 * @author hd
 * @date 2020-01-09 01:48
 */

@Setter
@Getter
@NoArgsConstructor
public class Paging implements Serializable {

    @NotNull(message = "PAGE_NOT_NULL")
    private Long page;

    @NotNull(message = "NUM_NOT_NULL")
    private Long num;

    public Long getIndex(){
        return (page-1)*num;
    }
}
